#ifndef CONF_H
#define CONF_H

#include "gui.h"
#include "script.h"

#define USER_MENU_ITEMS     14
#define CONF_STR_LEN        100

#define CONF_EMPTY          0
#define CONF_VALUE          1
#define CONF_VALUE_PTR      2
#define CONF_INT_PTR        3
#define CONF_CHAR_PTR       4
#define CONF_OSD_POS_PTR    5

typedef struct {
    unsigned short  x, y;
} OSD_pos;

typedef struct {
    int isNumb, isStr, isPInt, isPos;
    int numb;
    char* str;
    int* pInt;
    OSD_pos pos;
} tConfigVal;

typedef struct {
    int hide_osd;
    int show_histo;

    int batt_volts_max;
    int batt_volts_min;
    int batt_step_25;
    int batt_perc_show;
    int batt_icon_show;
    int clock_format;
    int clock_indicator;


    int show_values;

    int histo_mode;
    int histo_ignore_boundary;
    int histo_layout;
    int histo_show_ev_grid;
    int show_overexp;

    OSD_pos histo_pos;
    OSD_pos dof_pos;
    OSD_pos batt_icon_pos;
    OSD_pos space_icon_pos;
    OSD_pos space_hor_pos;
    OSD_pos space_ver_pos;
    OSD_pos batt_txt_pos;
    OSD_pos space_txt_pos;
    OSD_pos mode_state_pos;
    OSD_pos mode_raw_pos;
    OSD_pos values_pos;
    OSD_pos clock_pos;
    OSD_pos mode_ev_pos;

    color histo_color;
    color histo_color2; // markers/border
    color osd_color;
    color osd_color_warn;
//    color batt_icon_color;
    color menu_color;
    color menu_title_color;
    color menu_cursor_color;
    color menu_symbol_color;
    int menu_center;
    int menu_select_first_entry;
    int menu_symbol_enable;
    color osd_color_override;

    int font_cp;
    char menu_rbf_file[CONF_STR_LEN];
    char menu_symbol_rbf_file[CONF_STR_LEN];

    char lang_file[CONF_STR_LEN];

    int flashlight;
    int fast_ev;
    int fast_ev_step;
    int splash_show;
    int start_sound;
    int platformid;

    long alt_mode_button; //for S-series
    int alt_prevent_shutdown;
      
    int sel_frame;
    
    int save_frame_info;
    
    int expo_type;
} Conf;

extern Conf conf;

#define ALT_PREVENT_SHUTDOWN_NO         0
#define ALT_PREVENT_SHUTDOWN_ALT        1
#define ALT_PREVENT_SHUTDOWN_ALT_SCRIPT 2
#define ALT_PREVENT_SHUTDOWN_ALWAYS     3

#define SHOOTING_PROGRESS_NONE          0
#define SHOOTING_PROGRESS_STARTED       1
#define SHOOTING_PROGRESS_PROCESSING    2
#define SHOOTING_PROGRESS_DONE          3


extern void user_menu_restore();

extern int state_kbd_script_run;
extern int state_shooting_progress;
extern int state_save_raw_nth_only;
extern int state_expos_recalculated;
extern int state_expos_under;
extern int state_expos_over;

extern void conf_save();
extern void conf_restore();
extern void conf_load_defaults();
extern int shutter_int;
extern void conf_change_dng(void);
extern void conf_update_prevent_shutdown(void);
extern int conf_getValue(unsigned short id, tConfigVal* configVal);
extern int conf_setValue(unsigned short id, tConfigVal configVal);

// reyalp: putting these in conf, since the conf values are lookups for them
// prefixes and extentions available for raw images (index with conf.raw_prefix etc)
#define NUM_IMG_PREFIXES 3  // IMG_ CRW_ SND_ (could add ETC_ SDR_ AUT_ MVI_ MRK_)
#define NUM_IMG_EXTS 5      // .JPG .CRW .CR2 .THM .WAV (could add .AVI .MRK)
extern const char* img_prefixes[NUM_IMG_PREFIXES];
extern const char* img_exts[NUM_IMG_EXTS];
// ugh, but various things need it

#endif
